package com.sg.service.biz.app.impl;

import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.app.req.*;
import com.sg.dto.biz.app.res.*;
import com.sg.dto.integration.component.QueryConfItemMatchAnswerDetailComReqDto;
import com.sg.dto.integration.component.QueryConfItemMatchAnswerDetailComRespDto;
import com.sg.service.base.app.*;
import com.sg.service.biz.app.SystemTestDomainService;
import com.sg.service.biz.app.TaskService;
import com.sg.service.biz.app.WorkTasksService;
import com.sg.common.exception.Assert;
import com.wicket.okrapp.common.exception.BizException;
import com.wicket.okrcomponent.integration.ConfSchemeService;
import com.wicket.okrcomponent.integration.DivineDataService;
import com.wicket.okrcomponent.integration.InterfaceModeService;
import com.wicket.okrcomponent.integration.dto.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class ReportServiceImpl
        implements com.wicket.okrapp.biz.service.ReportService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MOmsTargetTimingTaskDispatchService mOmsTargetTimingTaskDispatchService;
    @Resource
    private MOmsExecuteCycleStageService mOmsExecuteCycleStageService;
    @Resource
    private SystemTestDomainService systemTestDomainService;
    @Resource
    private MOmsTaskService mOmsTaskService;
    @Resource
    private MOmsTspeCycleStageDataService mOmsTspeCycleStageDataService;
    @Resource
    private TaskService taskService;
    @Resource
    private MOmsTargetService mOmsTargetService;
    @Resource
    private ConfSchemeService confSchemeService;
    @Resource
    private InterfaceModeService interfaceModeService;
    @Resource
    private DivineDataService fwCompDivineDataClient;
    //@Resource
    //private MCustomFields4Service mCustomFields4Service;
    @Resource
    private NbReport nbReport;
    @Resource
    private WorkTasksService workTasksService;

    /**
     * D3-执行单内容汇报任务操作(公共)[7141]
     * gen by moon at 2/26/2024, 3:29:32 AM
     */
    @Trace(operationName = "D3-执行单内容汇报任务操作(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementSingleContentGenReportTaskComRespDto implementSingleContentGenReportTaskCom(ImplementSingleContentGenReportTaskComReqDto reqDto) {


//virtualUsage 3-2-09查询定时任务调度详情  44494
        OmsTargetTimingTaskDispatch omsTargetTimingTaskDispatch = null;
        QueryTimerTaskPlanDetailReq queryTimerTaskPlanDetailReq = new QueryTimerTaskPlanDetailReq();
        queryTimerTaskPlanDetailReq.setTaskDispatchTypeCode("CONTENT_SUBTASK");//sourceId:1015237_1_44494
        queryTimerTaskPlanDetailReq.setDispatchActionTypeCode("DISPATCH_ADD_REPORT_TASK");//sourceId:1015238_1_44494
        if (reqDto != null) {
            queryTimerTaskPlanDetailReq.setObjectId(reqDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:1015239_1_44494
            queryTimerTaskPlanDetailReq.setStandbyField2(reqDto.getCycleId());//SimpleFieldAssign//sourceId:1475808_1_44494
            queryTimerTaskPlanDetailReq.setThemeContentId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1015240_1_44494
        }

        /*3-2-09查询定时任务调度详情[3187]   */
        Assert.isNull(queryTimerTaskPlanDetailReq.getObjectId(), "D3-执行单内容汇报任务操作(公共)-3-2-09查询定时任务调度详情-归属对象内容ID不能为空", false);
        Assert.isNull(queryTimerTaskPlanDetailReq.getStandbyField2(), "D3-执行单内容汇报任务操作(公共)-3-2-09查询定时任务调度详情-备用字段2不能为空", false);
        Assert.isNull(queryTimerTaskPlanDetailReq.getTaskDispatchTypeCode(), "D3-执行单内容汇报任务操作(公共)-3-2-09查询定时任务调度详情-任务调度类型编码不能为空", false);
        Assert.isNull(queryTimerTaskPlanDetailReq.getDispatchActionTypeCode(), "D3-执行单内容汇报任务操作(公共)-3-2-09查询定时任务调度详情-任务调度的行为类型编码不能为空", false);
        Assert.isNull(queryTimerTaskPlanDetailReq.getThemeContentId(), "D3-执行单内容汇报任务操作(公共)-3-2-09查询定时任务调度详情-主题内容ID不能为空", false);
        omsTargetTimingTaskDispatch = mOmsTargetTimingTaskDispatchService.queryTimerTaskPlanDetail(queryTimerTaskPlanDetailReq)/*vcase invoke 本地 method 方法调用;*/;


        if ((reqDto != null && reqDto.getReportTaskOperation() != null && reqDto.getReportTaskOperation().equals("COMP_GEN_REPORT_TASK"))) {
            //if(D3-执行单内容汇报任务操作(公共).汇报任务验证操作 等于 补偿生成任务)  44442

            GenerateTargetReportTasksComRespDto generateTargetReportTasksComRespDto = null;
            if (omsTargetTimingTaskDispatch != null) {
                GenerateTargetReportTasksComReqDto generateTargetReportTasksComReqDto = new GenerateTargetReportTasksComReqDto();
                generateTargetReportTasksComReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1025419_1_59046
                if (omsTargetTimingTaskDispatch != null) {
                    generateTargetReportTasksComReqDto.setTimingTaskDispatchId(omsTargetTimingTaskDispatch.getTimingTaskDispatchId());//SimpleFieldAssign//sourceId:1025421_1_59046
                    generateTargetReportTasksComReqDto.setExecuteCycleStageId(omsTargetTimingTaskDispatch.getAddRuleInfoId());//SimpleFieldAssign//sourceId:1025423_1_59046
                    generateTargetReportTasksComReqDto.setCompareTime(omsTargetTimingTaskDispatch.getAutoPlanTime());//SimpleFieldAssign//sourceId:1025420_1_59046
                }
                if (reqDto != null) {
                    generateTargetReportTasksComReqDto.setEvaObjTargetCycleId(reqDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:1025418_1_59046
                }

                /*D3生成目标内容汇报任务(公共)[3293]   */
                Assert.isNull(generateTargetReportTasksComReqDto.getTimingTaskDispatchId(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-定时任务调度记录ID不能为空", false);
                Assert.isNull(generateTargetReportTasksComReqDto.getEvaObjTargetCycleId(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-被评对象目标周期ID不能为空", false);
                Assert.isNull(generateTargetReportTasksComReqDto.getExecuteCycleStageId(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-执行周期阶段ID不能为空", false);
                Assert.isNull(generateTargetReportTasksComReqDto.getCompareTime(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-比较时间不能为空", false);
                Assert.isNull(generateTargetReportTasksComReqDto.getSpaceId(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-创建于空间ID不能为空", false);
                generateTargetReportTasksComRespDto = taskService.generateTargetReportTasksCom(generateTargetReportTasksComReqDto)/*vcase invoke isSameApp*/;


            }
        } else if ((reqDto != null && reqDto.getReportTaskOperation() != null && reqDto.getReportTaskOperation().equals("REPORT_TASK_ REPLENISH"))) {
            //elseif(D3-执行单内容汇报任务操作(公共).汇报任务验证操作 等于 汇报任务补报)  58965

            if ((omsTargetTimingTaskDispatch != null)) {
                //if(3-2-09查询定时任务调度详情.出参 值不等于空 )  58976

                boolean bOOLEAN;
                if (omsTargetTimingTaskDispatch != null) {
                    OmsTargetTimingTaskDispatch omsTargetTimingTaskDispatch_2 = new OmsTargetTimingTaskDispatch();
                    omsTargetTimingTaskDispatch_2.setIsComplete("FALSE");//sourceId:1473049_1_58981
                    omsTargetTimingTaskDispatch_2.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID//sourceId:1473050_1_58981
                    omsTargetTimingTaskDispatch_2.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:1473051_1_58981
                    if (omsTargetTimingTaskDispatch != null) {
                        omsTargetTimingTaskDispatch_2.setTimingTaskDispatchId(omsTargetTimingTaskDispatch.getTimingTaskDispatchId());//SimpleFieldAssign//sourceId:1473047_1_58981
                    }

                    /*3-2-09重置定时调度是否完成为“否”（用于可以调度生成补报任务）[3186]   */
                    Assert.isNull(omsTargetTimingTaskDispatch_2.getTimingTaskDispatchId(), "D3-执行单内容汇报任务操作(公共)-3-2-09重置定时调度是否完成为“否”（用于可以调度生成补报任务）-定时任务调度记录ID不能为空", false);
                    Assert.isNull(omsTargetTimingTaskDispatch_2.getIsComplete(), "D3-执行单内容汇报任务操作(公共)-3-2-09重置定时调度是否完成为“否”（用于可以调度生成补报任务）-是否执行完成不能为空", false);
                    Assert.isNull(omsTargetTimingTaskDispatch_2.getOperationInductionId(), "D3-执行单内容汇报任务操作(公共)-3-2-09重置定时调度是否完成为“否”（用于可以调度生成补报任务）-操作人就职记录ID不能为空", false);
                    Assert.isNull(omsTargetTimingTaskDispatch_2.getOperateTime(), "D3-执行单内容汇报任务操作(公共)-3-2-09重置定时调度是否完成为“否”（用于可以调度生成补报任务）-操作时间不能为空", false);
                    bOOLEAN = mOmsTargetTimingTaskDispatchService.refreshTimerTaskPlan(omsTargetTimingTaskDispatch_2)/*vcase invoke 本地 method 方法调用;*/;


                }
                GenerateTargetReportTasksComRespDto generateTargetReportTasksComRespDto_2 = null;
                if (omsTargetTimingTaskDispatch != null) {
                    GenerateTargetReportTasksComReqDto generateTargetReportTasksComReqDto_1 = new GenerateTargetReportTasksComReqDto();
                    generateTargetReportTasksComReqDto_1.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1025419_1_58982
                    if (omsTargetTimingTaskDispatch != null) {
                        generateTargetReportTasksComReqDto_1.setTimingTaskDispatchId(omsTargetTimingTaskDispatch.getTimingTaskDispatchId());//SimpleFieldAssign//sourceId:1025421_1_58982
                        generateTargetReportTasksComReqDto_1.setExecuteCycleStageId(omsTargetTimingTaskDispatch.getAddRuleInfoId());//SimpleFieldAssign//sourceId:1025423_1_58982
                        generateTargetReportTasksComReqDto_1.setCompareTime(omsTargetTimingTaskDispatch.getAutoPlanTime());//SimpleFieldAssign//sourceId:1025420_1_58982
                    }
                    if (reqDto != null) {
                        generateTargetReportTasksComReqDto_1.setEvaObjTargetCycleId(reqDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:1025418_1_58982
                    }

                    /*D3生成目标内容汇报任务(公共)[3293]   */
                    Assert.isNull(generateTargetReportTasksComReqDto_1.getTimingTaskDispatchId(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-定时任务调度记录ID不能为空", false);
                    Assert.isNull(generateTargetReportTasksComReqDto_1.getEvaObjTargetCycleId(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-被评对象目标周期ID不能为空", false);
                    Assert.isNull(generateTargetReportTasksComReqDto_1.getExecuteCycleStageId(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-执行周期阶段ID不能为空", false);
                    Assert.isNull(generateTargetReportTasksComReqDto_1.getCompareTime(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-比较时间不能为空", false);
                    Assert.isNull(generateTargetReportTasksComReqDto_1.getSpaceId(), "D3-执行单内容汇报任务操作(公共)-D3生成目标内容汇报任务(公共)-创建于空间ID不能为空", false);
                    generateTargetReportTasksComRespDto_2 = taskService.generateTargetReportTasksCom(generateTargetReportTasksComReqDto_1)/*vcase invoke isSameApp*/;


                }
                ImplementGiveGracePeriodTimeComRespDto implementGiveGracePeriodTimeComRespDto = null;
                ImplementGiveGracePeriodTimeComReqDto implementGiveGracePeriodTimeComReqDto = new ImplementGiveGracePeriodTimeComReqDto();
                if (reqDto != null) {
                    implementGiveGracePeriodTimeComReqDto.setTaskId(reqDto.getTaskId());//SimpleFieldAssign//sourceId:1475496_1_59042
                    implementGiveGracePeriodTimeComReqDto.setTimeUnitType(reqDto.getTimeUnitType());//SimpleFieldAssign//sourceId:1475499_1_59042
                    implementGiveGracePeriodTimeComReqDto.setReplenishDelayDays(reqDto.getReplenishDelayDays());//SimpleFieldAssign//sourceId:1475498_1_59042
                }

                /*D3执行给予宽限时间量(公共)[8280]   */
                Assert.isNull(implementGiveGracePeriodTimeComReqDto.getTaskId(), "D3-执行单内容汇报任务操作(公共)-D3执行给予宽限时间量(公共)-任务ID不能为空", false);
                Assert.isNull(implementGiveGracePeriodTimeComReqDto.getTimeUnitType(), "D3-执行单内容汇报任务操作(公共)-D3执行给予宽限时间量(公共)-时间单位类型不能为空", false);
                Assert.isNull(implementGiveGracePeriodTimeComReqDto.getReplenishDelayDays(), "D3-执行单内容汇报任务操作(公共)-D3执行给予宽限时间量(公共)-申请补报宽限天数不能为空", false);
                implementGiveGracePeriodTimeComRespDto = implementGiveGracePeriodTimeCom(implementGiveGracePeriodTimeComReqDto)/*vcase invoke 同服务,同domain*/;


                boolean bOOLEAN_1;
                if (generateTargetReportTasksComRespDto_2 != null && generateTargetReportTasksComRespDto_2 != null && generateTargetReportTasksComRespDto_2.getTaskId() != null && implementGiveGracePeriodTimeComRespDto != null) {
                    OmsTask omsTask = new OmsTask();
                    omsTask.setIsSystemComplete("FALSE");//sourceId:1475754_1_58984
                    omsTask.setIsReplenishReport("TRUE");//sourceId:1473157_1_58984
                    omsTask.setIsRegularTask("TRUE");//sourceId:1475755_1_58984
                    omsTask.setBugTaskTypeCode("SUPPLY_REPORT");//sourceId:1475756_1_58984
                    omsTask.setPlanStartTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:1473158_1_58984
                    omsTask.setActualDelayDays(Long.valueOf(0));//CUSTOM_CONVENTION//sourceId:1473160_1_58984
                    if (generateTargetReportTasksComRespDto_2 != null) {
                        omsTask.setTaskId(generateTargetReportTasksComRespDto_2.getTaskId());//SimpleFieldAssign//sourceId:1473156_1_58984
                    }
                    if (implementGiveGracePeriodTimeComRespDto != null) {
                        omsTask.setPlanEndTime(implementGiveGracePeriodTimeComRespDto.getCalcTimeResult());//SimpleFieldAssign//sourceId:1473159_1_58984
                        omsTask.setActualDelayTime(implementGiveGracePeriodTimeComRespDto.getCalcTimeResult());//SimpleFieldAssign//sourceId:1473161_1_58984
                    }

                    /*3-7-01回写补报及重置宽限时间[2706]   */
                    Assert.isNull(omsTask.getTaskId(), "D3-执行单内容汇报任务操作(公共)-3-7-01回写补报及重置宽限时间-任务ID不能为空", false);
                    Assert.isNull(omsTask.getIsSystemComplete(), "D3-执行单内容汇报任务操作(公共)-3-7-01回写补报及重置宽限时间-是否系统完成不能为空", false);
                    Assert.isNull(omsTask.getIsReplenishReport(), "D3-执行单内容汇报任务操作(公共)-3-7-01回写补报及重置宽限时间-是否补报不能为空", false);
                    Assert.isNull(omsTask.getIsRegularTask(), "D3-执行单内容汇报任务操作(公共)-3-7-01回写补报及重置宽限时间-是否异常任务不能为空", false);
                    Assert.isNull(omsTask.getBugTaskTypeCode(), "D3-执行单内容汇报任务操作(公共)-3-7-01回写补报及重置宽限时间-异常任务原因不能为空", false);
                    Assert.isNull(omsTask.getPlanStartTime(), "D3-执行单内容汇报任务操作(公共)-3-7-01回写补报及重置宽限时间-计划开始时间不能为空", false);
                    Assert.isNull(omsTask.getPlanEndTime(), "D3-执行单内容汇报任务操作(公共)-3-7-01回写补报及重置宽限时间-计划结束时间不能为空", false);
                    Assert.isNull(omsTask.getActualDelayDays(), "D3-执行单内容汇报任务操作(公共)-3-7-01回写补报及重置宽限时间-实际宽限天数不能为空", false);
                    Assert.isNull(omsTask.getActualDelayTime(), "D3-执行单内容汇报任务操作(公共)-3-7-01回写补报及重置宽限时间-实际宽限时间不能为空", false);
                    bOOLEAN_1 = mOmsTaskService.updateTask(omsTask)/*vcase invoke 本地 method 方法调用;*/;


                }
                ImplementTaskAndProblemStatusCopywritComRespDto implementTaskAndProblemStatusCopywritComRespDto = null;
                if (generateTargetReportTasksComRespDto_2 != null && generateTargetReportTasksComRespDto_2 != null && generateTargetReportTasksComRespDto_2.getTaskId() != null) {
                    ImplementTaskAndProblemStatusCopywritComReqDto implementTaskAndProblemStatusCopywritComReqDto = new ImplementTaskAndProblemStatusCopywritComReqDto();
                    implementTaskAndProblemStatusCopywritComReqDto.setReportAndWorkTaskType("REPORT_TASK");//sourceId:1477261_1_59128
                    if (generateTargetReportTasksComRespDto_2 != null) {
                        implementTaskAndProblemStatusCopywritComReqDto.setEntityId(generateTargetReportTasksComRespDto_2.getTaskId());//SimpleFieldAssign//sourceId:1477262_1_59128
                    }

                    /*D3执行更新补报任务状态文案(公共)[8029]   */
                    Assert.isNull(implementTaskAndProblemStatusCopywritComReqDto.getReportAndWorkTaskType(), "D3-执行单内容汇报任务操作(公共)-D3执行更新补报任务状态文案(公共)-汇报任务及工作任务对象类型不能为空", false);
                    Assert.isNull(implementTaskAndProblemStatusCopywritComReqDto.getEntityId(), "D3-执行单内容汇报任务操作(公共)-D3执行更新补报任务状态文案(公共)-内容主键 ID不能为空", false);
                    implementTaskAndProblemStatusCopywritComRespDto = workTasksService.implementTaskAndProblemStatusCopywritCom(implementTaskAndProblemStatusCopywritComReqDto)/*vcase invoke isSameApp*/;


                }
            } else if ((omsTargetTimingTaskDispatch == null)) {
                //elseif(3-2-09查询定时任务调度详情.出参 值等于空 )  58977

//异常结束 58979
                throw new BizException("C00028", "对不起，没有数据！！", false);
            }
        }
        ImplementSingleContentGenReportTaskComRespDto retData = new ImplementSingleContentGenReportTaskComRespDto();


        return retData;
    }

    /**
     * D3执行自动汇报任务入参准备(公共)[8276]
     * gen by moon at 8/17/2024, 10:49:32 PM
     */
    @Trace(operationName = "D3执行自动汇报任务入参准备(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementAutoReportingTasksPreparationEnrollmentComRespDto implementAutoReportingTasksPreparationEnrollmentCom(ImplementAutoReportingTasksPreparationEnrollmentComReqDto reqDto) {


        ImplementFourthReceivingFieldRespDto receptionServiceRes_1 = null;
        GenerateDataObjectBatchCodeComRespDto generateDataObjectBatchCodeComRespDto_1 = null;
        OmsTspeCycleStageData omsTspeCycleStageData_1 = null;
        OmsTarget omsTarget_1 = null;
        CheckTimeScopeSearchComRespDto checkTimeScopeSearchComRespDto_1 = null;
//virtualUsage M3-获取计算开始时间  72288
        //ModelCode: receptionService
        ImplementFourthReceivingFieldRespDto receptionServiceRes = null;
        ImplementFourthReceivingFieldReqDto receptionServiceReq = new ImplementFourthReceivingFieldReqDto();
        receptionServiceReq.setCalcStartTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:1976949_1_72288

        /*M3-获取计算开始时间[8259]  用于特殊方法接收上游入参。 */
        Assert.isNull(receptionServiceReq.getCalcStartTime(), "D3执行自动汇报任务入参准备(公共)-M3-获取计算开始时间-计算开始时间不能为空", false);
        receptionServiceRes = nbReport.implementFourthReceivingField(receptionServiceReq);


        receptionServiceRes_1 = receptionServiceRes;
//virtualUsage D2生成数据对象批次标识(公共)  72289
        GenerateDataObjectBatchCodeComRespDto generateDataObjectBatchCodeComRespDto = null;
        GenerateDataObjectBatchCodeComReqDto generateDataObjectBatchCodeComReqDto = new GenerateDataObjectBatchCodeComReqDto();


        /*D2生成数据对象批次标识(公共)[9404]   */

        generateDataObjectBatchCodeComRespDto = interfaceModeService.generateDataObjectBatchCodeCom(generateDataObjectBatchCodeComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        generateDataObjectBatchCodeComRespDto_1 = generateDataObjectBatchCodeComRespDto;
//virtualUsage 3-3-11查周期阶段资料详情  58940
        OmsTspeCycleStageData omsTspeCycleStageData = null;
        QueryCycleStageDataDetailReq queryCycleStageDataDetailReq = new QueryCycleStageDataDetailReq();
        if (reqDto != null) {
            queryCycleStageDataDetailReq.setCycleStageDataId(reqDto.getCycleStageDataId());//SimpleFieldAssign//sourceId:1472099_1_58940
            queryCycleStageDataDetailReq.setThemeContentId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1472300_1_58940
        }

        /*3-3-11查周期阶段资料详情[2771]   */
        Assert.isNull(queryCycleStageDataDetailReq.getCycleStageDataId(), "D3执行自动汇报任务入参准备(公共)-3-3-11查周期阶段资料详情-周期阶段资料记录ID不能为空", false);
        Assert.isNull(queryCycleStageDataDetailReq.getThemeContentId(), "D3执行自动汇报任务入参准备(公共)-3-3-11查周期阶段资料详情-主题内容ID不能为空", false);
        omsTspeCycleStageData = mOmsTspeCycleStageDataService.queryCycleStageDataDetail(queryCycleStageDataDetailReq)/*vcase invoke 本地 method 方法调用;*/;
        Assert.isTrue(omsTspeCycleStageData == null || omsTspeCycleStageData.getCycleDataObjId() == null, "找不到数据，系统异常", false);

        omsTspeCycleStageData_1 = omsTspeCycleStageData;
//virtualUsage 3-3-01查目标详情  58946
        OmsTarget omsTarget = null;
        QueryTargetDetailReq queryTargetDetailReq = new QueryTargetDetailReq();
        if (reqDto != null) {
            queryTargetDetailReq.setEvaluationTemplateId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1472328_1_58946
        }

        /*3-3-01查目标详情[2488]   */
        Assert.isNull(queryTargetDetailReq.getEvaluationTemplateId(), "D3执行自动汇报任务入参准备(公共)-3-3-01查目标详情-归属评价模板ID不能为空", false);
        omsTarget = mOmsTargetService.queryTargetDetail(queryTargetDetailReq)/*vcase invoke 本地 method 方法调用;*/;


        omsTarget_1 = omsTarget;
//virtualUsage D2查自动汇报提前时间量及单位（用于计算自动汇报时间点）  58947
        QueryConfItemMatchAnswerDetailComRespDto queryConfItemMatchAnswerDetailComRespDto = null;
        QueryConfItemMatchAnswerDetailComReqDto queryConfItemMatchAnswerDetailComReqDto = new QueryConfItemMatchAnswerDetailComReqDto();
        queryConfItemMatchAnswerDetailComReqDto.setConfItemCode("AUTO_REPORT_EXECUTE_TIME_AMOUNT_ITEM");//CUSTOM_CONVENTION//sourceId:1472354_1_58947
        queryConfItemMatchAnswerDetailComReqDto.setIsPlatData("FALSE");//sourceId:1472363_1_58947
        if (reqDto != null) {
            queryConfItemMatchAnswerDetailComReqDto.setResultAspObjId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1472356_1_58947
        }

        /*D2查自动汇报提前时间量及单位（用于计算自动汇报时间点）[2486]   */
        Assert.isNull(queryConfItemMatchAnswerDetailComReqDto.getResultAspObjId(), "D3执行自动汇报任务入参准备(公共)-D2查自动汇报提前时间量及单位（用于计算自动汇报时间点）-开通对象ID不能为空", false);
        Assert.isNull(queryConfItemMatchAnswerDetailComReqDto.getConfItemCode(), "D3执行自动汇报任务入参准备(公共)-D2查自动汇报提前时间量及单位（用于计算自动汇报时间点）-配置项标识不能为空", false);
        Assert.isNull(queryConfItemMatchAnswerDetailComReqDto.getIsPlatData(), "D3执行自动汇报任务入参准备(公共)-D2查自动汇报提前时间量及单位（用于计算自动汇报时间点）-是否标准答案不能为空", false);
        queryConfItemMatchAnswerDetailComRespDto = confSchemeService.queryConfItemMatchAnswerDetailCom(queryConfItemMatchAnswerDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


//virtualUsage D2计算自动汇报时间点  58948
        ImplementTimeAddAndSubComRespDto implementTimeAddAndSubComRespDto = null;
        if (queryConfItemMatchAnswerDetailComRespDto != null) {
            ImplementTimeAddAndSubComReqDto implementTimeAddAndSubComReqDto = new ImplementTimeAddAndSubComReqDto();
            implementTimeAddAndSubComReqDto.setCalcFormula("SUBTRACTION_OF_TWO_NUM");//sourceId:1472375_1_58948
            if (reqDto != null) {
                implementTimeAddAndSubComReqDto.setComTimeField(reqDto.getComTimeField());//SimpleFieldAssign//sourceId:1472374_1_58948
            }
            if (queryConfItemMatchAnswerDetailComRespDto != null) {
                implementTimeAddAndSubComReqDto.setTimeUnitType(queryConfItemMatchAnswerDetailComRespDto.getExtensionField1());//SimpleFieldAssign//sourceId:1472376_1_58948
                implementTimeAddAndSubComReqDto.setComNumField(Long.valueOf(queryConfItemMatchAnswerDetailComRespDto.getEndValue()));//SimpleFieldAssign//sourceId:1472377_1_58948
            }

            /*D2计算自动汇报时间点[7369]   */
            Assert.isNull(implementTimeAddAndSubComReqDto.getComTimeField(), "D3执行自动汇报任务入参准备(公共)-D2计算自动汇报时间点-通用时间字段不能为空", false);
            Assert.isNull(implementTimeAddAndSubComReqDto.getCalcFormula(), "D3执行自动汇报任务入参准备(公共)-D2计算自动汇报时间点-通用计算公式不能为空", false);
            Assert.isNull(implementTimeAddAndSubComReqDto.getTimeUnitType(), "D3执行自动汇报任务入参准备(公共)-D2计算自动汇报时间点-时间单位类型不能为空", false);
            Assert.isNull(implementTimeAddAndSubComReqDto.getComNumField(), "D3执行自动汇报任务入参准备(公共)-D2计算自动汇报时间点-通用数值字段（整数型）不能为空", false);
            implementTimeAddAndSubComRespDto = interfaceModeService.implementTimeAddAndSubCom(implementTimeAddAndSubComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        }
//virtualUsage D2对比当前系统时间与计划结束时间  58949
        CheckTimeScopeSearchComRespDto checkTimeScopeSearchComRespDto = null;
        if (implementTimeAddAndSubComRespDto != null) {
            CheckTimeScopeSearchComReqDto checkTimeScopeSearchComReqDto = new CheckTimeScopeSearchComReqDto();
            checkTimeScopeSearchComReqDto.setCurrentTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:1472692_1_58949
            if (implementTimeAddAndSubComRespDto != null) {
                checkTimeScopeSearchComReqDto.setCompareTime(implementTimeAddAndSubComRespDto.getCalcTimeResult());//SimpleFieldAssign//sourceId:1472694_1_58949
            }

            /*D2对比当前系统时间与计划结束时间[3297]   */
            Assert.isNull(checkTimeScopeSearchComReqDto.getCurrentTime(), "D3执行自动汇报任务入参准备(公共)-D2对比当前系统时间与计划结束时间-当前时间不能为空", false);
            Assert.isNull(checkTimeScopeSearchComReqDto.getCompareTime(), "D3执行自动汇报任务入参准备(公共)-D2对比当前系统时间与计划结束时间-比较时间不能为空", false);
            checkTimeScopeSearchComRespDto = fwCompDivineDataClient.checkTimeScopeSearchCom(checkTimeScopeSearchComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            checkTimeScopeSearchComRespDto_1 = checkTimeScopeSearchComRespDto;
        }
        ImplementAutoReportingTasksPreparationEnrollmentComRespDto retData = new ImplementAutoReportingTasksPreparationEnrollmentComRespDto();
        if (omsTspeCycleStageData_1 != null) {
            retData.setIsPlanReceptionCycle(omsTspeCycleStageData_1.getIsPlanReceptionCycle());//SimpleFieldAssign//sourceId:1472332_1
        }
        if (omsTarget_1 != null) {
            retData.setTargetId(omsTarget_1.getTargetId());//SimpleFieldAssign//sourceId:1472335_1
        }
        if (checkTimeScopeSearchComRespDto_1 != null) {
            retData.setTimeCompareResult(checkTimeScopeSearchComRespDto_1.getTimeCompareResult());//SimpleFieldAssign//sourceId:1472698_1
        }
        if (receptionServiceRes_1 != null) {
            retData.setCalcStartTime(receptionServiceRes_1.getCalcStartTime());//SimpleFieldAssign//sourceId:1976950_1
        }
        if (generateDataObjectBatchCodeComRespDto_1 != null) {
            retData.setDataObjectBatchCode(generateDataObjectBatchCodeComRespDto_1.getDataObjectBatchCode());//SimpleFieldAssign//sourceId:1976951_1
        }


        return retData;
    }

    /**
     * D3执行给予宽限时间量(公共)[8280]
     * gen by moon at 1/8/2024, 6:33:40 AM
     */
    @Trace(operationName = "D3执行给予宽限时间量(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementGiveGracePeriodTimeComRespDto implementGiveGracePeriodTimeCom(ImplementGiveGracePeriodTimeComReqDto reqDto) {


        ImplementFourthReceivingFieldRespDto receptionServiceRes_1 = null;
        //virtualUsage 3-7-01查询任务详情  59012
        OmsTask omsTask = null;

        QueryTaskDetailReq queryTaskDetailReq = new QueryTaskDetailReq();
        queryTaskDetailReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1474811_1_59012
        if (reqDto != null) {
            queryTaskDetailReq.setTaskId(reqDto.getTaskId());//SimpleFieldAssign//sourceId:1474810_1_59012
        }

        /*3-7-01查询任务详情[2522]   */
        Assert.isNull(queryTaskDetailReq.getTaskId(), "D3执行给予宽限时间量(公共)-3-7-01查询任务详情-任务ID不能为空", false);
        Assert.isNull(queryTaskDetailReq.getSpaceId(), "D3执行给予宽限时间量(公共)-3-7-01查询任务详情-创建于空间ID不能为空", false);
        omsTask = mOmsTaskService.queryTaskDetail(queryTaskDetailReq)/*vcase invoke 本地 method 方法调用;*/;


        if ((reqDto != null && reqDto.getApplyDelayDays() != null && reqDto != null && reqDto.getReplenishDelayDays() == null && reqDto != null && reqDto.getTaskId() != null && reqDto != null && reqDto.getTimeUnitType() != null)) {
            //if((D3执行给予宽限时间量(公共).申请宽限天数 值不等于空  and D3执行给予宽限时间量(公共).申请补报宽限天数 值等于空  and D3执行给予宽限时间量(公共).任务ID 值不等于空  and D3执行给予宽限时间量(公共).时间单位类型 值不等于空 ))  59013

            ImplementTimeAddAndSubComRespDto implementTimeAddAndSubComRespDto = null;
            if (omsTask != null) {
                ImplementTimeAddAndSubComReqDto implementTimeAddAndSubComReqDto = new ImplementTimeAddAndSubComReqDto();
                implementTimeAddAndSubComReqDto.setCalcFormula("ADDITION_OF_TWO_NUM");//sourceId:1474801_1_59015
                if (omsTask != null) {
                    implementTimeAddAndSubComReqDto.setComTimeField(omsTask.getActualDelayTime());//SimpleFieldAssign//sourceId:1474800_1_59015
                }
                if (reqDto != null) {
                    implementTimeAddAndSubComReqDto.setTimeUnitType(reqDto.getTimeUnitType());//SimpleFieldAssign//sourceId:1474802_1_59015
                    implementTimeAddAndSubComReqDto.setComNumField(reqDto.getApplyDelayDays());//SimpleFieldAssign//sourceId:1474803_1_59015
                }

                /*D2-执行宽限时间加前端入参宽限时间量及单位[7369]   */
                Assert.isNull(implementTimeAddAndSubComReqDto.getComTimeField(), "D3执行给予宽限时间量(公共)-D2-执行宽限时间加前端入参宽限时间量及单位-通用时间字段不能为空", false);
                Assert.isNull(implementTimeAddAndSubComReqDto.getCalcFormula(), "D3执行给予宽限时间量(公共)-D2-执行宽限时间加前端入参宽限时间量及单位-通用计算公式不能为空", false);
                Assert.isNull(implementTimeAddAndSubComReqDto.getTimeUnitType(), "D3执行给予宽限时间量(公共)-D2-执行宽限时间加前端入参宽限时间量及单位-时间单位类型不能为空", false);
                Assert.isNull(implementTimeAddAndSubComReqDto.getComNumField(), "D3执行给予宽限时间量(公共)-D2-执行宽限时间加前端入参宽限时间量及单位-通用数值字段（整数型）不能为空", false);
                implementTimeAddAndSubComRespDto = interfaceModeService.implementTimeAddAndSubCom(implementTimeAddAndSubComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            }
            CalculateAdditionOfTwoNumsComRespDto calculateAdditionOfTwoNumsComRespDto = null;
            if (omsTask != null) {
                CalculateAdditionOfTwoNumsComReqDto calculateAdditionOfTwoNumsComReqDto = new CalculateAdditionOfTwoNumsComReqDto();
                if (omsTask != null) {
                    calculateAdditionOfTwoNumsComReqDto.setCalcPara1(omsTask.getActualDelayDays() != null ? Double.valueOf(omsTask.getActualDelayDays()) : null);//SimpleFieldAssign//sourceId:1474963_1_59019
                }
                if (reqDto != null) {
                    calculateAdditionOfTwoNumsComReqDto.setCalcPara2(reqDto.getApplyDelayDays() != null ? Double.valueOf(reqDto.getApplyDelayDays()) : null);//SimpleFieldAssign//sourceId:1474964_1_59019
                }

                /*D2-计算原宽限天数加新宽限天数[8137]   */
                Assert.isNull(calculateAdditionOfTwoNumsComReqDto.getCalcPara1(), "D3执行给予宽限时间量(公共)-D2-计算原宽限天数加新宽限天数-计算入参1不能为空", false);
                Assert.isNull(calculateAdditionOfTwoNumsComReqDto.getCalcPara2(), "D3执行给予宽限时间量(公共)-D2-计算原宽限天数加新宽限天数-计算入参2不能为空", false);
                calculateAdditionOfTwoNumsComRespDto = interfaceModeService.calculateAdditionOfTwoNumsCom(calculateAdditionOfTwoNumsComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            }
            boolean bOOLEAN;
            OmsTask omsTask_2 = new OmsTask();
            if (reqDto != null) {
                omsTask_2.setTaskId(reqDto.getTaskId());//SimpleFieldAssign//sourceId:1474831_1_59017
                omsTask_2.setApplyDelayDays(reqDto.getApplyDelayDays());//SimpleFieldAssign//sourceId:1474832_1_59017
            }

            /*3-7-01修改任务宽限时间[2706]   */
            Assert.isNull(omsTask_2.getTaskId(), "D3执行给予宽限时间量(公共)-3-7-01修改任务宽限时间-任务ID不能为空", false);
            bOOLEAN = mOmsTaskService.updateTask(omsTask_2)/*vcase invoke 本地 method 方法调用;*/;


//ModelCode: receptionService
            ImplementFourthReceivingFieldRespDto receptionServiceRes = null;
            if (implementTimeAddAndSubComRespDto != null) {
                ImplementFourthReceivingFieldReqDto receptionServiceReq = new ImplementFourthReceivingFieldReqDto();
                if (implementTimeAddAndSubComRespDto != null) {
                    receptionServiceReq.setSystemCurrentTime(implementTimeAddAndSubComRespDto.getCalcTimeResult());//SimpleFieldAssign//sourceId:1476938_1_59101
                }

                /*M3-约定出参：补报实际宽限时间[8259]  用于特殊方法接收上游入参。 */
                Assert.isNull(receptionServiceReq.getSystemCurrentTime(), "D3执行给予宽限时间量(公共)-M3-约定出参：补报实际宽限时间-系统当前时间不能为空", false);
                receptionServiceRes = nbReport.implementFourthReceivingField(receptionServiceReq);


                receptionServiceRes_1 = receptionServiceRes;
            }
        } else if ((reqDto != null && reqDto.getReplenishDelayDays() != null && reqDto != null && reqDto.getApplyDelayDays() == null && reqDto != null && reqDto.getTaskId() != null && reqDto != null && reqDto.getTimeUnitType() != null)) {
            //elseif((D3执行给予宽限时间量(公共).申请补报宽限天数 值不等于空  and D3执行给予宽限时间量(公共).申请宽限天数 值等于空  and D3执行给予宽限时间量(公共).任务ID 值不等于空  and D3执行给予宽限时间量(公共).时间单位类型 值不等于空 ))  59014

//ModelCode: receptionService
            ImplementFourthReceivingFieldRespDto receptionServiceRes_2 = null;
            ImplementFourthReceivingFieldReqDto receptionServiceReq_1 = new ImplementFourthReceivingFieldReqDto();
            receptionServiceReq_1.setSystemCurrentTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:1474961_1_59021

            /*M3约定当前时间[8259]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_1.getSystemCurrentTime(), "D3执行给予宽限时间量(公共)-M3约定当前时间-系统当前时间不能为空", false);
            receptionServiceRes_2 = nbReport.implementFourthReceivingField(receptionServiceReq_1);


            ImplementTimeAddAndSubComRespDto implementTimeAddAndSubComRespDto_2 = null;
            ImplementTimeAddAndSubComReqDto implementTimeAddAndSubComReqDto_1 = new ImplementTimeAddAndSubComReqDto();
            implementTimeAddAndSubComReqDto_1.setCalcFormula("ADDITION_OF_TWO_NUM");//sourceId:1474801_1_59016
            if (receptionServiceRes_2 != null) {
                implementTimeAddAndSubComReqDto_1.setComTimeField(receptionServiceRes_2.getSystemCurrentTime());//SimpleFieldAssign//sourceId:1474800_1_59016
            }
            if (reqDto != null) {
                implementTimeAddAndSubComReqDto_1.setTimeUnitType(reqDto.getTimeUnitType());//SimpleFieldAssign//sourceId:1474802_1_59016
                implementTimeAddAndSubComReqDto_1.setComNumField(reqDto.getReplenishDelayDays());//SimpleFieldAssign//sourceId:1474803_1_59016
            }

            /*D2-执行宽限时间加前端入参宽限时间量及单位[7369]   */
            Assert.isNull(implementTimeAddAndSubComReqDto_1.getComTimeField(), "D3执行给予宽限时间量(公共)-D2-执行宽限时间加前端入参宽限时间量及单位-通用时间字段不能为空", false);
            Assert.isNull(implementTimeAddAndSubComReqDto_1.getCalcFormula(), "D3执行给予宽限时间量(公共)-D2-执行宽限时间加前端入参宽限时间量及单位-通用计算公式不能为空", false);
            Assert.isNull(implementTimeAddAndSubComReqDto_1.getTimeUnitType(), "D3执行给予宽限时间量(公共)-D2-执行宽限时间加前端入参宽限时间量及单位-时间单位类型不能为空", false);
            Assert.isNull(implementTimeAddAndSubComReqDto_1.getComNumField(), "D3执行给予宽限时间量(公共)-D2-执行宽限时间加前端入参宽限时间量及单位-通用数值字段（整数型）不能为空", false);
            implementTimeAddAndSubComRespDto_2 = interfaceModeService.implementTimeAddAndSubCom(implementTimeAddAndSubComReqDto_1).getData()/*vcase invoke 跨dubbo调用;*/;


            boolean bOOLEAN_1;
            OmsTask omsTask_3 = new OmsTask();
            if (reqDto != null) {
                omsTask_3.setTaskId(reqDto.getTaskId());//SimpleFieldAssign//sourceId:1474831_1_59018
                omsTask_3.setReplenishDelayDays(reqDto.getReplenishDelayDays());//SimpleFieldAssign//sourceId:1474833_1_59018
            }

            /*3-7-01修改任务宽限时间[2706]   */
            Assert.isNull(omsTask_3.getTaskId(), "D3执行给予宽限时间量(公共)-3-7-01修改任务宽限时间-任务ID不能为空", false);
            bOOLEAN_1 = mOmsTaskService.updateTask(omsTask_3)/*vcase invoke 本地 method 方法调用;*/;


//ModelCode: receptionService
            ImplementFourthReceivingFieldRespDto receptionServiceRes_4 = null;
            if (implementTimeAddAndSubComRespDto_2 != null) {
                ImplementFourthReceivingFieldReqDto receptionServiceReq_2 = new ImplementFourthReceivingFieldReqDto();
                if (implementTimeAddAndSubComRespDto_2 != null) {
                    receptionServiceReq_2.setSystemCurrentTime(implementTimeAddAndSubComRespDto_2.getCalcTimeResult());//SimpleFieldAssign//sourceId:1476938_1_59102
                }

                /*M3-约定出参：补报实际宽限时间[8259]  用于特殊方法接收上游入参。 */
                Assert.isNull(receptionServiceReq_2.getSystemCurrentTime(), "D3执行给予宽限时间量(公共)-M3-约定出参：补报实际宽限时间-系统当前时间不能为空", false);
                receptionServiceRes_4 = nbReport.implementFourthReceivingField(receptionServiceReq_2);


                receptionServiceRes_1 = receptionServiceRes_4;
            }
        }
        ImplementGiveGracePeriodTimeComRespDto retData = new ImplementGiveGracePeriodTimeComRespDto();
        if (receptionServiceRes_1 != null) {
            retData.setCalcTimeResult(receptionServiceRes_1.getSystemCurrentTime());//SimpleFieldAssign//sourceId:1476940_1
        }


        return retData;
    }
    //
}
